package com.meituan.catering.management.order.biz.model.converter;

import com.meituan.catering.management.common.model.biz.AuditingBO;
import com.meituan.catering.management.order.biz.model.CateringOrderBO;
import com.meituan.catering.management.order.dao.model.CateringOrderDO;

/**
 * 从其他数据模型向订单BO的转换器
 */
public abstract class CateringOrderBOConverter{
    public static CateringOrderBO toCateringOrderBO(CateringOrderDO cateringOrderDO){
        CateringOrderBO cateringOrderBO = new CateringOrderBO();
        cateringOrderBO.setStatus(cateringOrderDO.getStatus());
        cateringOrderBO.setShopId(cateringOrderDO.getShopId());
        cateringOrderBO.setShopBusinessNo(cateringOrderDO.getShopBusinessNo());
        cateringOrderBO.setShopNameOnPlace(cateringOrderDO.getShopNameOnPlace());
        cateringOrderBO.setTableNo(cateringOrderDO.getTableNo());
        cateringOrderBO.setCustomerCount(cateringOrderDO.getCustomerCount());
        cateringOrderBO.setTotalPrice(cateringOrderDO.getTotalPrice());
        cateringOrderBO.setComment(cateringOrderDO.getComment());
        cateringOrderBO.setBillingPromotion(cateringOrderDO.getBillingPromotion());
        cateringOrderBO.setBillingPaid(cateringOrderDO.getBillingPaid());
        cateringOrderBO.setBillingPaymentChannel(cateringOrderDO.getBillingPaymentChannel());
        cateringOrderBO.setId(cateringOrderDO.getId());
        cateringOrderBO.setTenantId(cateringOrderDO.getTenantId());
        cateringOrderBO.setVersion(cateringOrderDO.getVersion());
        cateringOrderBO.setAuditing(toAuditingBO(cateringOrderDO));
        return cateringOrderBO;
    }

    public static AuditingBO toAuditingBO(CateringOrderDO cateringOrderDO){
        AuditingBO auditingBO = new AuditingBO();
        auditingBO.setCreatedBy(cateringOrderDO.getCreatedBy());
        auditingBO.setCreatedAt(cateringOrderDO.getCreatedAt());
        auditingBO.setLastModifiedBy(cateringOrderDO.getLastModifiedBy());
        auditingBO.setLastModifiedAt(cateringOrderDO.getLastModifiedAt());
        return auditingBO;
    }
}
